/*
 * Copyright 2010 Marcin Blazejewski
 *
 * This file is part of Nofate.
 *
 * Nofate is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Nofate is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Nofate. If not, see <http://www.gnu.org/licenses/>.
 *
 */


/*
 * re_init() // to create the window
 * draw on window usng:
 *   re_putchar() // C only
 *   re_puts()
 *   re_draw_view() // always draws at (0,0)
 * re_flush() // to apply the above
 * ...
 * re_end()
 * 
 * Use SDL directly to handle events
 */

#ifndef REDEYE_H_
#define REDEYE_H_

#include <abstract/map.hpp>
#include <SDL/SDL.h>

#define VIEW_DEFAULT_WIDTH          800
#define VIEW_DEFAULT_HEIGHT         600
#define DISPLAY_BPP                 32
#define CELL_SIZE                   8

#define EV_NONE                     0
#define EV_QUIT                     1
#define EV_KEYUP                    2
#define EV_KEYDOWN                  3

extern SDL_Surface *screen;

/* generic */

int hsv2rgb(int h, int s, int v);

/* create window, size in cells */
int     re_init(int screenw, int screenh);
/* cleanup */
void    re_end();
/* display what has been drawn */
void    re_flush();

/* structured display - maps & views */

/* draw a portion of the view: from (x,y) to (x+w,y+h) */
void    re_draw_view(MapView *view, int x, int y, int w, int h);
/* print text at (x,y) with colors fg/bg */
void    re_puts(int x, int y, int fg, int bg, const char *s);

/* overlay - simple markers & shapes */
void    reov_clear();
void    reov_line(int x0, int y0, int x1, int y1, unsigned int color);
void    reov_rect(int x0, int y0, int x1, int y1, unsigned int color);
void    reov_fillrect(int x0, int y0, int x1, int y1, unsigned int color);



#endif
